package com.changhong.framework.sdfs.namenode.server.utils;

import com.changhong.framework.sdfs.namenode.server.datanode.DataNodeInfo;

/**
 * 生成DataNode的id规则
 * @author Summer
 */
public class DataNodeIdUtils {
    public static String generalDataNodeId(DataNodeInfo dataNodeInfo){
        if(null==dataNodeInfo){
            throw new RuntimeException("dataNodeInfo must not be null");
        }
        //id的生产规则是由  appName:ip:port组成
       String dataNodeId=dataNodeInfo.getAppName()+":"+dataNodeInfo.getIpAddr()
               +":"+ dataNodeInfo.getPort();
        return dataNodeId;
    }
}
